package com.cn.demo4.controller;

import com.alibaba.fastjson.JSONObject;
import com.cn.demo4.entity.ConsultingEntity;
import com.cn.demo4.service.IConsultingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@Controller
public class ConsultingController {
    @Autowired
    private IConsultingService iConsultingService;

    @RequestMapping("/admin/consulting/findAll")
    public void findAll(HttpServletResponse resp) throws IOException {
        List<ConsultingEntity> list = iConsultingService.findAll();
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("list",list);
        resp.getWriter().println(jsonObject);
    }
//    @RequestMapping("/findAll")
//    public void getConsultingModelListForHome(HttpServletResponse resp) throws IOException {
//        List<ConsultingEntity> list = iConsultingService.getConsultingModelListForHome();
//        JSONObject jsonObject = new JSONObject();
//        jsonObject.put("list",list);
//        resp.getWriter().println(jsonObject);
//    }
}
